package com.by.basicweb.utils;

import com.by.toolkit.consts.WebGlobalConst;
import com.by.toolkit.enums.FlagEnum;
import com.by.toolkit.utils.ThreadLocalUtil;

public class UnAuthUtil {


    private UnAuthUtil() {
    }

    private static class UnAuthUtilHolder {
        public static final UnAuthUtil INSTANCE = new UnAuthUtil();
    }

    public static UnAuthUtil getInstance() {
        return UnAuthUtilHolder.INSTANCE;
    }

    public void put(Integer flag) {
        ThreadLocalUtil.put(WebGlobalConst.UN_AUTH, flag, false);
    }

    public boolean get() {
        return FlagEnum.resolve(ThreadLocalUtil.getInt(WebGlobalConst.UN_AUTH));
    }

    public void remove() {
        ThreadLocalUtil.removeKey(WebGlobalConst.UN_AUTH, true);
    }

}
